<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <script src="/static/js/echarts.min.js"></script>
    <link rel="stylesheet" href="/static/font/iconfont.css">
    <title>阿斯利康 -- 用户登录</title>
    <style>
        input {
            outline: none;
            -webkit-appearance: none;
            border-radius: 0;
            border-style: none;
            background-color: transparent;
        }
    </style>
</head>
<body background="/static/img/bg.png" style=" background-repeat:no-repeat ;
background-size:100% 100%;
background-attachment: fixed;height: 100%;display:flex;justify-content:center;align-items:center;">
<div style="width: 44rem;height: 28.75rem;background-image: url('/static/img/bg_login.png');background-size:100% 100%;background-repeat:no-repeat;">
    <div style="width: 14rem;height: 10rem;margin-top: 12.5rem;" class="layui-container">
        <div class="layui-row" style="height:2.2rem;box-shadow: 0px 2px 1.7px 0.3px rgba(0, 0, 0, 0.1);
	border-radius: 2px ;line-height: 2.2rem;
	border: solid 1px rgba(246, 204, 226, 1);">
            <i class="iconfont icon-yonghu" style="color: #e89cc4;margin-left: 5px"></i>
            <input type="text" placeholder="请输入用户名" style="margin-left: 10px" id="username">
        </div>
        <div class="layui-row" style="height:2.2rem;box-shadow: 0px 2px 1.7px 0.3px rgba(0, 0, 0, 0.1);margin-top: 10px;
	border-radius: 2px ;line-height: 2.2rem;
	border: solid 1px rgba(246, 204, 226, 1);">

            <i class="iconfont icon-mima" style="color: #e89cc4;margin-left: 5px"></i>
            <input type="password" placeholder="请输入密码" style="margin-left: 10px" id="password">
        </div>
        <div class="layui-row" style="margin-top: 20px;height: 2.2rem">
            <button class="layui-row" style="background-color: rgba(246, 204, 226, 1);width: 100%;height: 100%;
	box-shadow: 0px 2px 1.7px 0.3px
		rgba(0, 0, 0, 0.1);
	border-radius: 2px 2px 2px 2px;
	border: solid 1px rgba(246, 204, 226, 1);
" onclick="login()">登录
            </button>
        </div>
    </div>
</div>


<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="/static/layui/layui.js"></script>
<script>
  var $, layer;
  layui.use('layer', function () {
    $ = layui.jquery;
    layer = layui.layer;

    if (window !== window.top) {
      parent.window.location.href = '/admin/login'
    }
  });


  function login() {
    var username = $('#username').val();
    var password = $('#password').val();
    if (!username) {
      layer.msg('用户名不能为空', {
        time: 2000,
      });
      return;
    }

    if (!password) {
      layer.msg('密码不能为空', {
        time: 2000,
      });
      return;
    }
    $.post('/auth/login', {
      username: username,
      password: password
    }, function (data) {
      if (data.errno === 0) {
        localStorage.azToken = data.data.token;
        window.location.href = '/admin?x-az-token='
          + localStorage.azToken;
      } else {
        layer.msg('用户名或者密码不正确', {
          time: 2000,
        });
      }
    });
  }
</script>
</body>
</html>